package router

import (
	"longmen/server/internal/api"
	_const "longmen/server/pkg/common/helper/const"

	"github.com/labstack/echo/v4"
	echoSwagger "github.com/swaggo/echo-swagger"
)

func InitRouter(e *echo.Echo, base api.Controller, authFunc echo.MiddlewareFunc) {
	e.GET("/healthCheck", func(c echo.Context) error {
		c.JSON(200, "pong !!!")
		return nil
	})
	if _const.SwagIsEnable {
		e.GET("/swagger/*", echoSwagger.WrapHandler)
	}
	group := e.Group("/api")
	initPublicRoute(group, base, authFunc)
	initUserRoute(group, base, authFunc)
	initActivityRoute(group, base, authFunc)
	initChatRoute(group, base, authFunc)
	initExpertRoute(group, base, authFunc)
	initGuessRoute(group, base, authFunc)
	initLiveRoute(group, base, authFunc)
	initPayRoute(group, base, authFunc)
	initSportsRoute(group, base, authFunc)
	initVideoRoute(group, base, authFunc)
	initGameRoute(group, base, authFunc)

	groupWebApi := e.Group("/webapi")
	initPublicRoute(groupWebApi, base, authFunc)
	initUserRoute(groupWebApi, base, authFunc)
	initActivityRoute(groupWebApi, base, authFunc)
	initChatRoute(groupWebApi, base, authFunc)
	initExpertRoute(groupWebApi, base, authFunc)
	initGuessRoute(groupWebApi, base, authFunc)
	initLiveRoute(groupWebApi, base, authFunc)
	initPayRoute(groupWebApi, base, authFunc)
	initSportsRoute(groupWebApi, base, authFunc)
	initVideoRoute(groupWebApi, base, authFunc)
	initGameRoute(group, base, authFunc)

	//groups := make([]*echo.Group, 0)
	//groups = append(groups, e.Group("/api"))
	//groups = append(groups, e.Group("/webapi"))
	//for idx := range groups {
	//	//红包
	//	groupHongBao := groups[idx].Group("/hongBao")
	//	{
	//		groupHongBao.POST("/getHongBaoSetting", base.GetHongBaoSetting)
	//	}
	//
	//}
}
